<template>
  <div class="comment-wrapper">
    <div class="items">
      <div class="item" v-for="(item, index) in list" :key="index">
        <div class="left">
          <img :src="item.user.avatarUrl" alt />
        </div>
        <div class="right">
          <div class="top">
            <span class="user">{{item.user.nickname}}</span>
            <span class="content">{{item.content}}</span>
          </div>
          <div class="bottom">
            <div class="time">{{item.time | formatTime}}</div>
            <div class="like-wrapper">
              <span>👍</span>
(6666)
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
import moment from "moment";
export default {
  data() {
    return {
      list: []
    };
  },
  filters: {
    formatTime(time) {
      return moment(time).format("YYYY-MM-DD HH:mm:ss");
    }
  },
  created() {
    axios({
      url: "http://183.237.67.218:3000/comment/music?id=" + this.$route.query.id
    }).then(res => {
      window.console.log(res);
      this.list = res.data.hotComments;
    });
  }
};
</script>

<style>
</style>